//package cn.guxinhu.billsystem.servier;
//
//
//import cn.guxinhu.billsystem.entity.Bill;
//import cn.guxinhu.billsystem.entity.BillQueryVo;
//import cn.guxinhu.billsystem.user.pojo.BillUser;
//import cn.guxinhu.billsystem.mapper.IBillMapper;
//import cn.guxinhu.billsystem.utils.PictureTools;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.sql.Date;
//import java.text.SimpleDateFormat;
//import java.util.GregorianCalendar;
//import java.util.List;
//import java.util.concurrent.Executors;
//import java.util.concurrent.ScheduledExecutorService;
//import java.util.concurrent.TimeUnit;
//
///**
// * @author Guxinhu
// * @create 2021-05-10 11:36
// */
//@Service
//public class BillService {
//    @Autowired
//    private IBillMapper ibillMapper;
//    @Autowired
//    private PictureTools pictureTools;
//
//
//    /**
//     * 查询所有
//     *
//     * @Method: findAllUser()
//     */
//    public List<Bill> findAll() throws Exception {
//        List<Bill> bills = ibillMapper.findAll();
//        return bills;
//    }
//    public List<Bill> findAllRecycle() throws Exception {
//        List<Bill> bills = ibillMapper.findAllRecycle();
//        return bills;
//    }
//
////
////    public Page<Bill> findUserByQueryVo(BillQueryVo billQueryVo) throws Exception {
////        if (billQueryVo.getRows() == null || billQueryVo.getPage() == null)
////            return null;
////        Page<Bill> billPage = new Page<>();
////
////        Integer count = ibillMapper.findCountUserByQueryVo(billQueryVo);
////        List<Bill> list = ibillMapper.findUserByQueryVo(billQueryVo);
////
////        billPage.setTotal(count);
////        billPage.setRows(list);
////
////        return billPage;
////    }
////
//    /**
//     * 保存用户
//     *
//     * @Method: saveBUser()
//     */
//    public void saveBUser(BillQueryVo billQueryVo) throws Exception {
//        billQueryVo.setUserName(((BillUser) mySession.getSession().getAttribute("billUser")).getUserName());
//        billQueryVo.setOrderTime(new Date(new SimpleDateFormat("yyyy-MM-dd").parse(billQueryVo.getOtime()).getTime()));
//        billQueryVo.setCompletionTime(new Date(new SimpleDateFormat("yyyy-MM-dd").parse(billQueryVo.getCtime()).getTime()));
//        billQueryVo.setPicture(pictureTools.getPictureUpload(billQueryVo.getPicturePath()));
//        System.out.println("------->");
//        System.out.println(billQueryVo.getPicturePath().getContentType());
//        System.out.println(billQueryVo.getPicturePath().getOriginalFilename());
//        System.out.println(billQueryVo.getPicturePath().getSize());
//        if (billQueryVo.getTotalMoney() == (billQueryVo.getReceived())){
//            billQueryVo.setState(1);
//        }
//        ibillMapper.saveBill(billQueryVo);
//        boolean live = true;// 标记变量，表示线程是否可中止；
//        //Runnable：实现了Runnable接口，jdk就知道这个类是一个线程
//        Runnable runnable = new Runnable() {
//            //创建 run 方法
//            public void run() {
//                System.out.println("222");
//            }
//        };
//        GregorianCalendar calendar = new GregorianCalendar(2021, 6, 23, 11, 20, 0);
//        System.out.println(calendar.getTimeInMillis());
//        ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
//        service.schedule(runnable, 10, TimeUnit.SECONDS);
//    }
//////
//////
////
////    /**
////     * 查询（名字）
////     *
////     * @return
////     * @Method: findByName()
////     */
////    public bill findByName(billQueryVo billQueryVo) throws Exception {
////        bill = ibillMapper.findByName(billQueryVo);
////        return bill;
////    }
//
//    //
////    /**
////     * 查询（id）
////     *
////     * @return
////     * @Method: findById()
////     */
////    public BUser findById(Integer uId) throws Exception {
////        mybatisBUser.init();
////        bUser = mybatisBUser.getiUserDao().findById(uId);
////        mybatisBUser.destroy();
////        return bUser;
////    }
////
//    //修改用户
//    public void updateBill(BillQueryVo billQueryVo) throws Exception {
//        if (billQueryVo.getTotalMoney() == (billQueryVo.getReceived())){
//            billQueryVo.setState(1);
//        }else {
//            billQueryVo.setState(0);
//        }
//        ibillMapper.updateBill(billQueryVo);
//    }
//
//    public void recycle(Integer[] ids) throws Exception {
//            ibillMapper.recycle(ids);
//    }
//    public void recovery(Integer[] ids) throws Exception {
//            ibillMapper.recovery(ids);
//    }
////
//    //删除用户
//    public void deleteBill(Integer[] ids) throws Exception {
//        ibillMapper.deleteBill(ids);
//    }
//    public Bill findPictureById(Integer bId) throws Exception {
//        Bill bill =  ibillMapper.findPictureById(bId);
//        return bill;
//    }
//
//
//}
